<template>
  <div class="page mine">
    <div class="head">
      <div class="user">
        <img class="user-img" src="../../assets/user_img.jpg">
        <h1 class="font-big username">{{deliverinfo.name}}</h1>
      </div>
    </div>
    <h1 class="biaoti" @click="income">账户明细<span class="more"></span></h1>
    <div class="row">
      <div class="flex-wrap">
        <div class="flex-item left">
          <p class="font-small font-color-normal">今日接单数</p>
          <h1 class="font-normal font-color-shallow">{{data.today_num}}</h1>
        </div>
        <div class="flex-item">
          <p class="font-small font-color-normal">今日营业额</p>
          <h1 class="font-normal font-color-shallow">{{data.today_money}}</h1>
        </div>
      </div>
    </div>
    <div class="btn-bottom">
      <x-button class="btn-login" @click.native="toexit">退出登录</x-button>
    </div>
  </div>
</template>

<script>
import { Group, Cell,XButton } from 'vux'
export default {
  components: {
    Group,
    Cell,
    XButton
  },
  data () {
    return {
      deliverinfo : '',
      data:''
    }
  },
  mounted(){
    let url = '/Deliver/index'
    let token = localStorage.getItem("access_token");
    let params = {"access_token":token}
    this.ajaxplugin(url,params,(res) => {
        this.deliverinfo = res.data.deliver_info
        this.data = res.data
    })
    this.$store.dispatch('hideNodata') 
  },
  methods:{
    toexit(){
      this.exit();
      this.$router.push({ path: '/login' })
    },
    income(){
      this.$router.push({ path: '/income' })
    }
  }
}
</script>

<style lang="stylus">
.mine
  .head
    height 220px
    width 100%
    background #0093f9
    .user
      text-align center
      margin-top 80px
      .user-img 
        width 80px
        height 80px
        border-radius 50%
        border 2px solid #ffffff
      .username
        margin-top 10px
        color #ffffff
  .row
    padding 20px 0
    border-bottom 1px solid #eeeeee
    .flex-item
      text-align center
      &.left
        border-right 1px solid #eeeeee
      h1
        margin-top 10px
  .btn-bottom
    position absolute
    bottom 60px
    width 100%
    .btn-login
      padding 0 20px
      font-size 14px
      width 30%
</style>
